-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[opt](cloud) Prioritize scheduling the most recently active tablets in cloud #59539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
ac383bb to
a71331b
Compare
|
run buildall |
1 similar comment
|
run buildall |
TPC-H: Total hot run time: 31449 ms |
TPC-DS: Total hot run time: 176500 ms |
fe/fe-core/src/main/java/org/apache/doris/catalog/TabletAccessStats.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/catalog/TabletAccessStats.java
Show resolved
Hide resolved
| private ThreadPoolExecutor asyncExecutor; | ||
|
|
||
| // Default time window: 1 hour | ||
| private static final long DEFAULT_TIME_WINDOW_SECOND = 3600L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be configruable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一般人也不会改这个。而且show tablet 里面的列名(AccessCount1H),动态改的话不好适配
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是窗口大小支持修改,是个合理的诉求,我想想啊
| * Get shard index for a given ID | ||
| */ | ||
| private int getShardIndex(long id) { | ||
| return (int) (id & (SHARD_SIZE - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better use some hash function, e.g. crc/md5, on id first and then take modulo
fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
Show resolved
Hide resolved
| * Result for top N query | ||
| */ | ||
| public static class AccessStatsResult { | ||
| public final long id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabletId?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id就行了,其实这个结构不光能统计tablet的最近访问频次,
可能TabletAccessStats.java,命名也不太好
| long currentTime = System.currentTimeMillis(); | ||
| // Record tablet access | ||
| // Get real tabletId from TabletInvertedIndex instead of calculating it | ||
| long tabletId = Env.getCurrentInvertedIndex().getTabletIdByReplicaId(replicaId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any performance issue with inverted idex accessing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里倒是可能有问题,所以做了个async record。
replica.java 里面没有带tablet信息,
不太想大改,就这样反查的
| } catch (Exception e) { | ||
| // If executor is shutdown or queue is full, silently ignore | ||
| // Statistics can tolerate some loss | ||
| if (LOG.isDebugEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log info here, exception here is abnormal
51e3d4b to
8080351
Compare
What problem does this PR solve?
Starting from the getBackendId of the replica, implement a sliding window approach (in TabletAccessStats.java) to count read and write operations over the last hour. The accuracy of this count isn't critical, as the aim is to indicate relative activity levels.
Display these statistics in the SHOW TABLETS FROM TABLE and SHOW TABLET {tabletId} commands.
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)